import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: 'login'
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('../views/Login.vue')
  },
  {
    path: '/home',
    name: 'home',
    component: () => import('../views/Home.vue'),
    children: [
      {
        path: '/home/list',
        name: 'list',
        component: () => import('../views/List.vue')
      },
      {
        path:'/home/add',
        name:'add',
        component:()=>import('../views/Add.vue')
      }
    ]
  },
  {
    path: '/menu',
    name: 'menu',
    component: () => import('../components/Menu.vue'),
  }
]

const router = new VueRouter({
  mode: 'history',
  routes
})

export default router
